package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.EcologyPoolCommunityServiceRankIncomeConf;
import com.sc.nft.mapper.EcologyPoolCommunityServiceRankIncomeConfMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 刘国航
 * @since 2024/7/16
 */
@Slf4j
@Repository
public class EcologyPoolCommunityServiceRankIncomeConfDao extends ServiceImpl<EcologyPoolCommunityServiceRankIncomeConfMapper, EcologyPoolCommunityServiceRankIncomeConf> {

    public List<EcologyPoolCommunityServiceRankIncomeConf> getListByConfId(Long confId) {
        LambdaQueryWrapper<EcologyPoolCommunityServiceRankIncomeConf> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(EcologyPoolCommunityServiceRankIncomeConf::getEcologyPoolCommunityServiceRankConfId, confId);
        queryWrapper.orderByAsc(EcologyPoolCommunityServiceRankIncomeConf::getStartRank);
        return baseMapper.selectList(queryWrapper);
    }

    public List<EcologyPoolCommunityServiceRankIncomeConf> getConfigId(Long configId) {
        LambdaQueryWrapper<EcologyPoolCommunityServiceRankIncomeConf> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(EcologyPoolCommunityServiceRankIncomeConf::getEcologyPoolCommunityServiceRankConfId, configId);
        wrapper.orderByAsc(EcologyPoolCommunityServiceRankIncomeConf::getSort);
        return baseMapper.selectList(wrapper);
    }
}
